﻿using System.Text;
//using DataSyn.ORM;
//using DataSyn.Model;

namespace ConsoleOldToNew
{
    class ZheJiangProtocol_Data
    {
        //##ST=01;TP=;PW=123456;MN=3301033340001A;DATATIME=20120717143033;CP=0001=#;0003=#;0020=#;0021=#;0022=#;0023=#;0024=#;0025=#;0026=#;0027=#;0028=#;0029=#;0030=#;0031=#&&EDB2\r\n
        /// <summary>
        /// 得到协议数据
        /// </summary>
        /// <param name="objManiProtocol"></param>
        /// <param name="strDatas"></param>
        /// <returns></returns>
        public static string GetProtocolDataInfo(MainProtocol objManiProtocol, string[] strDatas)
        {
            StringBuilder sb = new StringBuilder("ST=" + objManiProtocol.StrST + ";TP=" + objManiProtocol.StrTP + ";PW=" + objManiProtocol.StrPW + ";MN=" + objManiProtocol.StrMN + ";DATATIME=" + objManiProtocol.StrDATATIME + ";");
            if (strDatas != null)
            {
                sb.Append("CP=0001=" + objManiProtocol.StrControllerId + ";0003=" + objManiProtocol.StrDate + ";");

                foreach (string strData in strDatas)
                {
                    if (strData != null)
                    {
                        sb.Append(strData + ";");
                    }
                }
            }
            sb.Remove(sb.Length - 1, 1);
            sb.Append("&&");
            return sb.ToString();

        }

    }
}
